package com.thz.houserental.infrastructure.web.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.thz.houserental.domain.user.UserVo;
import com.thz.houserental.infrastructure.web.dto.EmailLoginDto;
import com.thz.houserental.infrastructure.web.dto.RegisterDto;
import com.thz.houserental.infrastructure.table.User;
import com.thz.houserental.infrastructure.web.dto.WechatLoginDto;
import com.thz.houserental.infrastructure.web.vo.CurrentUser;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.List;

public interface UserService extends IService<User> {

    /**
     * @param userDto 用户注册信息
     * @return token
     */
    String registerNewUserAccount(RegisterDto userDto);

    /**
     * 邮箱登录
     * @return token
     */
    String loginByEmail(EmailLoginDto loginDto);

    UserDetails loadUserByUsername(String username);
    
    List<String> getUserRolesByEmail(String email);

    /**
     * 微信登录
     * @return token
     */
    String loginByWechat(WechatLoginDto loginDto);

    CurrentUser getCurrentUser();

    /**
     * 分页查询用户信息
     * @param userVoPage 分页参数
     * @param userVo state
     * @return 分页信息
     */
    IPage<UserVo> selectPageVo(Page<UserVo> userVoPage, QueryWrapper<User> queryWrapper);

    UserVo getUserVo(String userId);

    void updateUserDetail(User user);
}
